﻿using System;
using System.Linq.Expressions;
using System.Reactive;

namespace WcfDynamicProxy
{
    /// <summary>
    /// produces reactive queries
    /// </summary>
    /// <typeparam name="TService"></typeparam>
    public interface IQueryFactory<TService>
    {
        /// <summary>
        /// Automatic query. Channel is created and destroyed after query is finished
        /// </summary>
        /// <typeparam name="TResult">Type of result</typeparam>
        /// <param name="call"></param>
        /// <returns></returns>
        IObservable<TResult> ExecuteQuery<TResult>(Expression<Func<TService, TResult>> call);

        /// <summary>
        /// Automatic query. Channel is created and destroyed after query is finished
        /// </summary>
        /// <typeparam name="TResult">Type of result</typeparam>
        /// <param name="call"></param>
        /// <returns></returns>
        IObservable<Unit> ExecuteQuery(Expression<Action<TService>> call);
    }
}